package net.xju3_4.entity;

import net.xju3_4.common.utils.DateUtils;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;

public class Goods {
    private static final DateTimeFormatter FORMATTER =
            DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
    private Integer id;
    private String name;
    private Integer price;
    private Date pubdate;
    private Integer typeId;
    private String intro;
    private String picture;
    private Integer flag;
    private Integer deleted;
    private LocalDateTime createTime;

    private String pubdateStr;
    private String createTimeStr;

    public String getPubdateStr() {
        return DateUtils.parseDate2Str(pubdate);
    }

    public String getCreateTimeStr() {
        return createTime!= null ? createTime.format(FORMATTER) : null;
    }

    public Goods() {
    }

    public Goods(Integer id, String name, Integer price, Date pubdate, Integer typeId, String intro, String picture, Integer flag, Integer deleted, LocalDateTime createTime) {
        this.id = id;
        this.name = name;
        this.price = price;
        this.pubdate = pubdate;
        this.typeId = typeId;
        this.intro = intro;
        this.picture = picture;
        this.flag = flag;
        this.deleted = deleted;
        this.createTime = createTime;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getPrice() {
        return price;
    }

    public void setPrice(Integer price) {
        this.price = price;
    }

    public Date getPubdate() {
        return pubdate;
    }

    public void setPubdate(Date pubdate) {
        this.pubdate = pubdate;
    }

    public Integer getTypeId() {
        return typeId;
    }

    public void setTypeId(Integer typeId) {
        this.typeId = typeId;
    }

    public String getIntro() {
        return intro;
    }

    public void setIntro(String intro) {
        this.intro = intro;
    }

    public String getPicture() {
        return picture;
    }

    public void setPicture(String picture) {
        this.picture = picture;
    }

    public Integer getFlag() {
        return flag;
    }

    public void setFlag(Integer flag) {
        this.flag = flag;
    }

    public Integer getDeleted() {
        return deleted;
    }

    public void setDeleted(Integer deleted) {
        this.deleted = deleted;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }
}
